package com.hqyj.hrms.modules.personnel.controller;


import com.hqyj.hrms.modules.personnel.entity.Employee;
import com.hqyj.hrms.modules.personnel.entity.SexCount;
import com.hqyj.hrms.modules.personnel.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zyj
 * @since 2021-09-27
 */
@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Autowired
    EmployeeService employeeService;

    //员工年龄统计
    @GetMapping("/countAge")
    public List<Map> getCountAge() {
        return employeeService.getAge();
    }

    //员工学历统计
    @GetMapping("/countEdu")
    public List<Map> getCountEdu() {
        return employeeService.getEdu();
    }

    //员工性别统计
    @GetMapping("/countSex")
    public List<Map> getCountSex() {
        return employeeService.getSex();
    }

    //查询
    @GetMapping("/list")
    public HashMap<String, Object> list(Employee employee) {
        return employeeService.list(employee);
    }

    @GetMapping("/add")
    public HashMap<String, Object> add(Employee employee) {
        return employeeService.add(employee);
    }

    @GetMapping("/update")
    public HashMap<String, Object> update(Employee employee) {
        return employeeService.update(employee);
    }

    @GetMapping("/del")
    public HashMap<String, Object> del(Integer id) {
        return employeeService.del(id);
    }

    //查询
    @GetMapping("/search")
    public HashMap<String, Object> search(String str1, String str2) {
        return employeeService.query(str1, str2);
    }
}

